<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // let name = 'lipan'
        // let age = 18;
        // function Hobby(){
        //     return 'chi'
        // }
        // let obj = {
        //     sex :'nv'
        // }
        // let info = `my name is${name} age is${age},sex :${obj.sex}my hobby${Hobby()}`
        // console.log(info)

        //对象的解析赋值
        let obj = {age:18,school:'daxue',address:{city:'北京'}}
        let age = 19;
        let{age:myage,school,email='qq.com',address:{city}} =obj
        // let {age:myage,school,email='qq.com',address:{city}} = obj
        console.log(myage)
        console.log(school)
        console.log(email)
        console.log(city)
        console.log(obj.age)

        let name = '李冰冰'
        let user = {
            age:30,
            sex:'nv'
        }
        let {name :username="里默认",sex,emaail='mooo'} =user;
        console.log(username,sex,email)

        //数组的结构赋值
        // var arr=[1,2]
        // var [a,b] = arr;
        // console.log(a)
        // console.log(b)
        //省略前几个数组
        let player =['zhangsan','lisi','wangwu']
        let [,,hanhan] =player
        console.log(hanhan)
        //交换两个变量的值
        // let a = 10;
        // let b = 20;
        // [a,b] =[b,a]
        // console.log(a,b)
        
        //扩展运算符
        function sum(...args){
            console.log(args)
        }
        sum(1,2,4)
        
        //合并数组
        let a = [1,2,3];
        let b = [2,4,6,8]
        console.log([...a,...b])
    </script>
</body>
</html>